const wx2my = require('../../../wx2my');
const Behavior = require('../../../Behavior');
var app = getApp();

var util = require("../../utils/util.js");

var base = require('./../../../config.js');

var WxParse = require('./../wxParse/wxParse.js');

Page({
  data: {
    toView: 'inToView0',
    p_server_list: [],
    hotel_info: [],
    open_time: 2018,
    imgUrl: wx2my.getStorageSync(["imgUrl1"]).data,
    service_facility: []
  },
  scrollToViewFn: function (e) {
    var _id = e.currentTarget.dataset.id;
    console.log(e);
    this.setData({
      toView: 'inToView' + _id
    });
    console.log(this.data.toView);
  },
  onLoad: function (t) {
    var that = this; // 设置标题背景一级颜色

    wx2my.setNavigationBarColor({
      frontColor: '#000000',
      backgroundColor: '#ffffff'
    }); // 获取数据

    wx2my.request({
      url: base.siteroot + "?i=" + base.acid + "&c=entry&a=wxapp&do=PjDetails&m=zh_jdgjb&seller_id=" + t.hotel_id,
      header: {
        'content-type': 'application/json' // 默认值

      },
      success: function (res) {
        console.log(res);
        that.setData({
          p_server_list: res.data.offsite_facilities,
          hotel_info: res.data,
          open_time: res.data.open_time.substring(0, 4),
          service_facility: res.data.service_facility
        });
        WxParse.wxParse('introduction', 'html', res.data.introduction, that, 5);
      }
    });
  },
  onReady: function () {},
  onShow: function () {
    var e = this;
    app.getUserInfo(function (t) {
      console.log(t), e.setData({
        users: t
      });
    });
  },
  onHide: function () {},
  onUnload: function () {},
  onPullDownRefresh: function () {},
  onReachBottom: function () {},
  onShareAppMessage: function () {}
});